import { ResponseCode } from "./../../enum/appEnum";
import Mock from "mockjs2";
import { builder, getBody } from "../util";

Mock.mock(/\/orgManage\/queryFilesByCondition.xops/, "post", {
  "code": "777",
  "msg": "成功",
  "datas": [
    {
      "fileName": "eHR_IMOrg_20210704.txt",
      "fileSize": "76.99KB",
      "fileDate": "2021-07-09 13:54:24"
    },
    {
      "fileName": "eHR_IMOrg_20210324.txt",
      "fileSize": "68.37KB",
      "fileDate": "2021-04-07 13:46:14"
    }
  ]
});

Mock.mock(/\/orgManage\/importOrgInfo.xops/, "post", {
  code: "777",
  msg: "成功",
  datas: "",
});


Mock.mock(/\/orgManage\/selectOrg.xops/, "post", {
  "code": "777",
  "msg": "成功",
  "datas": [{
    orgName: "测试集团",
    orgCode: "310100000",
    children: [{
        orgName: "测试",
        parentOrgId: 1,
        children: [{
            orgName: "总行",
            orgCode: "310100002",
            orgSeq: ".1.2.",
            isleaf: "y",
            orgId: 2
        }],
        orgCode: "310100001",
        orgSeq: ".1.",
        isleaf: "n",
        orgId: 1
    },
    {
        orgName: "基金公司（虚拟）",
        children: [{
            orgName: "测试",
            parentOrgId: 4,
            orgCode: "001",
            orderNum: "4",
            orgSeq: ".3.4.",
            isleaf: "y",
            orgId: 4
        }],
        orgCode: "310100004",
        orgSeq: ".3.",
        isleaf: "n",
        orgId: 3
    },
    {
        orgName: "上银瑞金",
        orgCode: "310100006",
        orgSeq: ".5.",
        isleaf: "y",
        orgId: 5
    },
    {
        orgName: "村镇银行（虚拟）",
        orgCode: "310100007",
        orgSeq: ".8.",
        isleaf: "y",
        orgId: 6
    },
    {
        orgName: "上银基金",
        orgCode: "310100005",
        orderNum: "0",
        orgSeq: ".7.",
        isleaf: "y",
        orgId: 7
    }]
}]
});

Mock.mock(/\/orgManage\/addOrg.xops/, "post", {
  code: "777",
  msg: "成功",
  datas: "",
});

Mock.mock(/\/orgManage\/updateOrg.xops/, "post", {
  code: "777",
  msg: "成功",
  datas: "",
});

Mock.mock(/\/orgManage\/deleteOrg.xops/, "post", {
  code: "777",
  msg: "成功",
  datas: "",
});

Mock.mock(/\/orgManage\/orgToUsers.xops/, "post", {
  code: "777",
  msg: "成功",
  datas: "",
});

Mock.mock(/\/orgManage\/delOrgToUsers.xops/, "post", {
  code: "777",
  msg: "成功",
  datas: "",
});

Mock.mock(/\/authManage000\/getEmployee.xops/, "post", {
  "code": "777",
  "msg": "成功",
  "datas": [
    {
      "empId": 3,
      "empCode": "张三",
      "operatorId": 3,
      "userId": null,
      "empName": null,
      "realName": null,
      "gender": null,
      "birthDate": null,
      "position": null,
      "empStatus": null,
      "cardType": null,
      "cardNo": null,
      "inDate": null,
      "outDate": null,
      "faxNo": null,
      "mobileNo": null,
      "qq": null,
      "party": null,
      "degree": null,
      "sortno": null,
      "major": null,
      "specialty": null,
      "workeXp": null,
      "regDate": null,
      "createtime": "2021-04-11T16:00:00.000+00:00",
      "lastmodytime": "2021-04-11T16:00:00.000+00:00",
      "orgIdlist": null,
      "orgId": null,
      "remark": null,
      "tenantId": "default",
      "appId": null,
      "weibo": null,
      "otel": null,
      "oaddress": null,
      "ozipcode": null,
      "oemail": null,
      "htel": null,
      "haddress": null,
      "hzipcode": null,
      "pemail": null,
      "orgs": [{
        "setId": "11",
    "setName": "测试套别",
        "orgCode": "123",
        "orgId": "66",
        "orgName": "测试"
    },{
      "setId": "22",
    "setName": "测试套别",
      "orgCode": "666",
      "orgId": "77",
      "orgName": "测试"
  }],
    },
    {
      "empId": 4,
      "empCode": "李四",
      "operatorId": 4,
      "userId": null,
      "empName": null,
      "realName": null,
      "gender": null,
      "birthDate": null,
      "position": null,
      "empStatus": null,
      "cardType": null,
      "cardNo": null,
      "inDate": null,
      "outDate": null,
      "faxNo": null,
      "mobileNo": null,
      "qq": null,
      "party": null,
      "degree": null,
      "sortno": null,
      "major": null,
      "specialty": null,
      "workeXp": null,
      "regDate": null,
      "createtime": "2021-04-11T16:00:00.000+00:00",
      "lastmodytime": "2021-04-11T16:00:00.000+00:00",
      "orgIdlist": null,
      "orgId": null,
      "remark": null,
      "tenantId": "default",
      "appId": null,
      "weibo": null,
      "otel": null,
      "oaddress": null,
      "ozipcode": null,
      "oemail": null,
      "htel": null,
      "haddress": null,
      "hzipcode": null,
      "pemail": null,
      "orgs": [{
        "setId": "33",
    "setName": "测试套别",
        "orgCode": "456",
        "orgId": "77",
        "orgName": "试试"
    },{
      "setId": "44",
    "setName": "测试套别",
      "orgCode": "3572",
      "orgId": "732",
      "orgName": "模拟"
  }],
    },
    {
      "empId": 5,
      "empCode": "王五",
      "operatorId": 5,
      "userId": null,
      "empName": null,
      "realName": null,
      "gender": null,
      "birthDate": null,
      "position": null,
      "empStatus": null,
      "cardType": null,
      "cardNo": null,
      "inDate": null,
      "outDate": null,
      "faxNo": null,
      "mobileNo": null,
      "qq": null,
      "party": null,
      "degree": null,
      "sortno": null,
      "major": null,
      "specialty": null,
      "workeXp": null,
      "regDate": null,
      "createtime": "2021-04-11T16:00:00.000+00:00",
      "lastmodytime": "2021-04-11T16:00:00.000+00:00",
      "orgIdlist": null,
      "orgId": null,
      "remark": null,
      "tenantId": "default",
      "appId": null,
      "weibo": null,
      "otel": null,
      "oaddress": null,
      "ozipcode": null,
      "oemail": null,
      "htel": null,
      "haddress": null,
      "hzipcode": null,
      "pemail": null,
      "orgs": [{
        "setId": "55",
    "setName": "测试套别",
        "orgCode": "789",
        "orgId": "88",
        "orgName": "实施"
    },{
      "setId": "66",
    "setName": "测试套别",
      "orgCode": "7436264",
      "orgId": "96564",
      "orgName": "mock数据"
  }],
    }
  ],
  "pageIndex": "1",
  "pageSize": "20",
  "total": "1"
});

Mock.mock(/\/employeeManage\/delOrgToUsers.xops/, "post", {
  code: "777",
  msg: "成功",
  datas: "",
});

Mock.mock(/\/employeeManage\/delOrgToUsers.xops/, "post", {
  code: "777",
  msg: "成功",
  datas: "",
});

Mock.mock(/\/employeeManage\/delOrgToUsers.xops/, "post", {
  code: "777",
  msg: "成功",
  datas: "",
});
// 配置维护 微前端服务器注册
const serverQuery = () => {
  const data = Mock.mock({
    "datas|1-60": [
      {
        "webServId|+1": () => Mock.mock("@integer(1000, 9999)"),
        "webServIp|+1": () => Mock.mock("@integer(1000, 9999)"),
        "webServPort|+1": () => Mock.mock("@string(25)"),
        "servRemark|+1": () => Mock.mock("@ctitle"),
        "dataServers|+1": () => Mock.mock("@csentence"),
        "envType|+1": () => Mock.mock("@integer(6)"),
        "envLocal|+1": () => Mock.mock("@integer(1000, 9999)"),
        "rootNode|+1": () => Mock.mock("@ctitle"),
      },
    ],
  });
  return builder(data?.datas, "", "777", {
    "Custom-Header": Mock.mock("@guid"),
  });
};
// 微前端服务器注册 - 新增
const serverAdd = () => {
  return builder([], "新增成功", "777", {
    "Custom-Header": Mock.mock("@guid"),
  });
};
 // 微前端服务器注册 - 编辑
const serverEdit = () => {
  return builder([], "更新成功", "777", {
    "Custom-Header": Mock.mock("@guid"),
  });
};

Mock.mock(/\/AppMicuiserverManager\/selectAppMicuiserver.xops/, "post", serverQuery); // 微前端服务器注册 - 查询
Mock.mock(/\/AppMicuiserverManager\/addAppMicuiserver.xops/, "post", serverAdd); // 微前端服务器注册 - 新增
Mock.mock(/\/AppMicuiserverManager\/updateAppMicuiserver.xops/, "post", serverEdit); // 微前端服务器注册 - 编辑

// 用户管理
Mock.mock(/\/authManage000\/selectuser.xops/, "post", {
  "code": "777",
  "msg": "成功",
  "datas": [
    {
      "operatorId": 1638,
      "tenantId": null,
      "userId": "315489",
      "userName": "于文鹏",
      "authmodes": null,
      "status": null,
      "unlockTime": "2022-04-21T20:19:48.719+00:00",
      "menuType": null,
      "lastLogin": "2022-04-21T20:19:48.719+00:00",
      "startDate": null,
      "createUser": "318694",
      "createTime": "2022-04-21T20:19:48.000+00:00",
      "roles": null,
      "orgId": null,
      "orgs": [{
        "setId": "88",
    "setName": "测试套别",
        "orgCode": "123",
        "orgId": "66",
        "orgName": "测试"
    },{
      "setId": "22",
    "setName": "测试套别",
      "orgCode": "666",
      "orgId": "77",
      "orgName": "测试"
  }],
      "orgName": null
    },
    {
      "operatorId": 1639,
      "tenantId": null,
      "userId": "315490",
      "userName": "张三",
      "authmodes": null,
      "status": null,
      "unlockTime": "2022-04-21T20:19:48.719+00:00",
      "menuType": null,
      "lastLogin": "2022-04-21T20:19:48.719+00:00",
      "startDate": null,
      "createUser": "318694",
      "createTime": "2022-04-21T20:19:48.000+00:00",
      "roles": null,
      "orgId": null,
      "orgs": [{
        "setId": "33",
    "setName": "测试套别",
        "orgCode": "456",
        "orgId": "77",
        "orgName": "试试"
    },{
      "setId": "44",
    "setName": "测试套别",
      "orgCode": "3572",
      "orgId": "732",
      "orgName": "模拟"
  }],
      "orgName": null
    },
    {
      "operatorId": 1640,
      "tenantId": null,
      "userId": "315490",
      "userName": "李四",
      "authmodes": null,
      "status": null,
      "unlockTime": "2022-04-21T20:19:48.719+00:00",
      "menuType": null,
      "lastLogin": "2022-04-21T20:19:48.719+00:00",
      "startDate": null,
      "createUser": "318694",
      "createTime": "2022-04-21T20:19:48.000+00:00",
      "roles": null,
      "orgId": null,
      "orgs": [{
        "setId": "55",
    "setName": "测试套别",
        "orgCode": "789",
        "orgId": "88",
        "orgName": "实施"
    },{
      "setId": "66",
    "setName": "测试套别",
      "orgCode": "7436264",
      "orgId": "96564",
      "orgName": "mock数据"
  }],
      "orgName": null
    }
  ],
  "pageIndex": "1",
  "pageSize": "20",
  "total": "1"
});

Mock.mock(/\/authManage000\/adduser.xops/, "post", {
  code: "777",
  msg: "成功",
  datas: "",
});

Mock.mock(/\/authManage000\/updateuser.xops/, "post", {
  code: "777",
  msg: "成功",
  datas: "",
});

Mock.mock(/\/authManage000\/deluser.xops/, "post", {
  code: "777",
  msg: "成功",
  datas: "",
});

Mock.mock(/\/busi\/auditListQuery.xops/, "post", {
  "code": "777",
  "msg": "成功",
  "datas": [
      {
          "reqKey": "1234",
          "reqUrl": "XXX/XXX",
          "menuName": "回单数据分析大屏",
          "netArea": null,
          "result": "成功",
          "operator": "301401",
          "opName": "测试",
          "opTime": "2022-08-29 01:00:00",
          "opType": "others",
          "reqBody":"{\"beginDate\":\"2022-08-01\",\"payAcNo\":\"\",\"endDate\":\"2022-08-31\",\"pageIndex\":1,\"pageSize\":20,\"rcvAcNo\":\"\",\"serialNo\":\"\",\"status\":\"\"}"
      },
      {
        "reqKey": "6666",
        "reqUrl": "YYY/YYY",
        "menuName": "回单数据分析大屏",
        "netArea": null,
        "result": "成功",
        "operator": "301401",
        "opName": "测试",
        "opTime": "2022-08-29 01:00:00",
        "opType": "others",
        "reqBody":"{'ddd':'fff'}"
    },
    {
      "reqKey": "7777",
      "reqUrl": "ZZZ/ZZZ",
      "menuName": "回单数据分析大屏",
      "netArea": null,
      "result": "成功",
      "operator": "301401",
      "opName": "测试",
      "opTime": "2022-08-29 01:00:00",
      "opType": "others",
      "reqBody":""
  }
  ],
  "pageIndex": "1",
  "pageSize": "20",
  "total": "1"
});

//微前端界面查询
Mock.mock(/\/Preserve\/queryList.xops/, "post", {
  "code": "777",
"msg": "成功",
"datas": [
    {
        "micuiId": "bsmp_vc_cetificate_check",
        "micuiName": "凭证模板参数审核",
        "micuiDesc": null,
        "ischeck": "1",
        "micuiType": "page",
        "micuiTag": "1",
        "micuiUrl": "/app/bsmp_vc/cetificate/cetificate-flow",
        "webServId": "bsmp_vc",
        "checkServices":" [{\"xname\":\"凭证模板审核列表查询\",\"xpass\":\"y\",\"xurl\":\"/check/list\",\"xaudit\":\"n\"},{\"xname\":\"凭证审核\",\"xpass\":\"y\",\"xurl\":\"/check/audit\",\"xaudit\":\"n\"}]",
        "checkUicoms": "[{\"buttonName\":\"凭证模板审核列表查询\",\"xpass\":\"y\",\"xurl\":\"/check/list\",\"buttonId\":\"001\"}，]",
        "micuiParams": null,
        "defaultIcon": null
    },
],
"pageIndex": "1",
"pageSize": "20",
"total": "1"
});
// 微前端服务器注册查询
Mock.mock(/\/AppMicuiserverManager\/selectAppMicuiserver.xops/, "post", {
"code": "777",
"msg": "成功",
"datas": [
    {
        "webServId": "umpTest001",
        "webServIp": "localhost",
        "webServPort": "18212",
        "servRemark": "Simon本机1",
        "dataServers": null,
        "envType": "SIT1",
        "envLocal": "ZJ1",
        "rootNode": "/app/test002"
    },
    {
        "webServId": "umpTest001@",
        "webServIp": "localhost",
        "webServPort": "18213",
        "servRemark": "Simon本机2",
        "dataServers": null,
        "envType": "SIT2",
        "envLocal": "ZJ2",
        "rootNode": "/app/test003"
    }
],
"pageIndex": "1",
"pageSize": "20",
"total": "1"
});
// 微前端界面修改/default/Preserve/addPreserve.xops
Mock.mock(/\/Preserve\/addPreserve.xops/, "post", {
code: "777",
msg: "成功",
datas: "",
});
// 微前端界编辑
Mock.mock(/\/Preserve\/editPreserve.xops/, "post", {
code: "777",
msg: "成功",
datas: "",
});

// 微前端界面删除
Mock.mock(/\/Preserve\/delPreserve.xops/, "post", {
code: "777",
msg: "成功",
datas: "",
});

// Mock.mock(/\/AppMicuiserverManager\/selectAppMicuiserver.xops/, "post", serverQuery); // 微前端服务器注册 - 查询
Mock.mock(/\/AppMicuiserverManager\/addAppMicuiserver.xops/, "post", serverAdd); // 微前端服务器注册 - 新增
Mock.mock(/\/AppMicuiserverManager\/updateAppMicuiserver.xops/, "post", serverEdit); // 微前端服务器注册 - 编辑


//  租户   租户注册管理
const lesseeQuery = () => {
  const data = Mock.mock({
    "datas|1-60": [
      {
        "tenantId|+1": () => Mock.mock("@integer(1000, 9999)"),
        "tenantName|+1": () => Mock.mock("@ctitle"),
        "tenantMgrNms|+1": () => Mock.mock("@csentence"),
      },
    ],
  });
  return builder(data?.datas, "", "777", {
    "Custom-Header": Mock.mock("@guid"),
  });
};
// 租户注册管理 新增
const lesseeAdd = () => {
  return builder([], "新增成功", "777", {
    "Custom-Header": Mock.mock("@guid"),
  });
};
// 租户注册管理 修改
const lesseeUpdate = () => {
  return builder([], "更新成功", "777", {
    "Custom-Header": Mock.mock("@guid"),
  });
};
// 租户注册管理 删除
const lesseeDel = () => {
  return builder([], "删除成功", "777", {
    "Custom-Header": Mock.mock("@guid"),
  });
};

Mock.mock(/\/appTenants\/queryPage.xops/, "post", lesseeQuery);  // 租户注册管理 查询 
Mock.mock(/\/appTenants\/add.xops/, "post", lesseeAdd); // 租户注册管理 新增
Mock.mock(/\/appTenants\/update.xops/, "post", lesseeUpdate); // 租户注册管理 修改
Mock.mock(/\/appTenants\/delete.xops/, "post", lesseeDel); // 租户注册管理 删除
